package com.guys8.cemsbackend.entity;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * (ClassUser)表实体类
 *
 * @author breeze
 * @since 2022-08-24 16:11:31
 */
@Setter
@Getter
@ToString
@Data
@Accessors(chain = true)
public class ClassUser extends Model<ClassUser> {

    @MppMultiId
    @TableField(value = "class_id")
    private Integer classId;
    @MppMultiId
    @TableField(value = "user_id")
    private Integer userId;
    //0-学生，1-老师
    private Integer userType;
    private Date applicationTime;
    //0-审核中，1-审核成功，2-审核失败
    private Integer auditState;
    private Date auditTime;
    private Integer auditHumanid;
//    @TableLogic
    private Integer isDelete;
    private Integer ext1;
    private String ext2;

    public ClassUser(Integer userid, Integer classId,Integer userType) {
        setClassId(classId);
        setUserId(userid);
        setUserType(userType);
        setIsDelete(0);
        if(userType==1) {
            setAuditState(1);
            return ;
        }
        setApplicationTime(new Date());
        setAuditState(0);
    }

    public void audit(Integer userid,Integer state){
        setAuditState(state);
        setAuditTime(new Date());
        setAuditHumanid(userid);
    }

}

